package interfaces.impl.actions;

import extra.Position;

import constants.*;
import interfaces.impl.Action;
import objects.SpetialFeature;
import universe.Universe;

public class ActionMove extends Action{

	
	private double x;
	private double y;
	
	public ActionMove(int priority) {
		super(priority);
		this.id=Constants.ACTION_MOVE;
	}

	public ActionMove() {
		this.id=Constants.ACTION_MOVE;
	}

	@Override
	public boolean processAction(Universe world) {
		SpetialFeature feat= null;
		double xToGo;
		double yToGo;
		for(SpetialFeature fe : target.getListFeatures()){
			if(fe.getId()==Constants.SPETIAL_FEATURE_IS_MOVING){
				feat=fe;
				break;
			}
		}
		
		/*if(target.getPosition().getX()==x && target.getPosition().getY()==y){
			if(feat!=null){
				feat.setValue(Constants.FALSE);
			}
		}
		else{
			
		}*/
			
		if(feat!=null){
			feat.setValue(Constants.TRUE);
		}
		target.setPosition(new Position(x, y));
		
		
		
		
		
		//System.out.println("Le puse la posicion x"+x+" y "+y+" number "+target.getObjectReference());
		return true;
	}

	public double getX() {
		return x;
	}

	public void setX(double x) {
		this.x = x;
	}

	public double getY() {
		return y;
	}

	public void setY(double y) {
		this.y = y;
	}

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return "MOVE";
	}

	

}
